package com.mybatis;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @ClassName IntegerTypeHandler
 * @Description Int类型设计
 * @Author DuX1aoQiang
 * @Date 2023/5/22 16:41
 * @Version 1.0
 */
public class IntegerTypeHandler implements TypeHandler<Integer> {
    @Override
    public void setParameter(PreparedStatement statement, int i, Integer value) {
        try {
            statement.setInt(i, value);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Integer getResult(ResultSet set, String colName) throws SQLException {
        return set.getInt(colName);
    }
}
